<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true" :headerHeight="10"><pages-item :list="dataList"></pages-item></s-pull-scroll>
		<mix-cart ref="mixCart"></mix-cart>
		<drag-button  :isDock="true" @btnClick="btnClick"></drag-button>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
import pagesItem from '@/components/page-item-list/page-goos-item.vue';
import mixCart from "@/components/mix-cart/index.vue";
import dragButton from "@/components/drag-button/drag-button.vue";
export default {
	components: {
		dragButton,
		pagesItem,
		mixCart
	},
	data() {
		return {
			keywords: '',
			dataList: []
		};
	},
	onLoad(options) {
		this.setNavTitle(options.name);
		this.keywords = options.name;
		this.refresh();
	},
	methods: {
		btnClick(){
			this.$refs.mixCart.open();
		},
		onItemCartClick(e){
			
		},
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid: uni.getStorageSync('uid'),
				type:0,
				key:this.keywords,
				pageNo: pullScroll.page,
				pageSize: '10'
			};
			const res = await this.$request('goods/list', data, { showLoading: true });
			if (pullScroll.page == 1) this.dataList = [];
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>
<style>
page {
	background: #f6f6f6;
}
</style>
<style scoped lang="scss">
.btn {
	width: 141upx;
	height: 64upx;
	text-align: center;
	line-height: 64upx;
	background: #ffd6d6;
	border-radius: 32upx;
	font-size: 26upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #cc1313;
}
.del-img {
	width: 30upx;
	height: 30upx;
}

.red {
	color: #ff0000;
}

.search-img {
	width: 38upx;
	height: 38upx;
}

.uni-icon-search {
	font-size: 30upx;
}

.help-tips {
	font-size: 26upx;
	color: #999;
	line-height: 26upx;
	padding: 0 0 0 30upx;
	margin: 0;
	width: 80%;
	text-align: left;
}

.help-tips.color999 {
	color: #999999;
}
.search-pop {
	padding: 20upx;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.top-input {
	flex: 1;
	height: 70upx;
	line-height: 70upx;
	background-color: #f6f6f6;
	border-radius: 35upx;
	color: #74718c;
	padding-left: 35upx;
}

.top-input input {
	height: 100%;
	width: 100%;
	padding-left: 16upx;
}
.search-btn {
	height: 100%;
	color: #333333;
	font-size: 27upx;
}

.search-cat {
	padding: 20upx;
	background: #ffffff;
}
.search-cat .search-cat-tit {
	position: relative;
	display: flex;
	align-items: center;
	font-weight: bold;
	justify-content: space-between;
}
.search-cat .search-cat-tit .up-menu {
	font-size: 30upx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #333333;
	line-height: 55upx;
}
</style>
